package edu.bw.dao.impl;

import edu.bw.dao.AccountDao;
import edu.bw.po.Account;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class AccountDaoImpl implements AccountDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    /**
     * 从账户扣钱或价钱（转账）
     * @param account 账户对象
     */
    @Override
    public void updateAccount(Account account) {
        jdbcTemplate.update("UPDATE spring.account SET money=money+? WHERE name=?",account.getPrice(),account.getName());
    }
}
